#!/bin/bash	


. config.sh

rm -rf "$WORK_DIR"*
if [ $? -ne 0 ]; then
    umount `find $WORK_DIR -name proc` &> /dev/null
    umount `find $WORK_DIR -name sys` &> /dev/null
    rm -rf "$WORK_DIR"*
fi

if [[ -z $1 ]]
then
	echo "Unknown version."
	exit 1
fi
if echo "$CI_PROJECT" | grep '_gcov'; then
    rm -f version
    wget "http://$IP/internal_use_only/EulerOS/EulerOS_V200R008C00/EulerOS_V200R008C00_ARM64/version"
    version=`cat version`"_gcov"
else
    version="$1"
fi
[[ -d $WORK_DIR ]] || mkdir -p $WORK_DIR
echo $version > $WORK_DIR'version'
echo "version is $version"

rm -f $WORK_DIR'DEBUG'
if [[ $2 -eq 1 ]]; then
    touch $WORK_DIR'DEBUG'
fi

exit 0
